from Case.python_ui.Common.basepage import Basepage
import time, pytest
from Case.python_ui.Common.commontool import CommonTool
from selenium.webdriver.common.action_chains import ActionChains
from Case.python_ui.Test_data.login_data import Logindata
from Case.python_ui.PageLocate.login_locator import Loginlocator
from Case.python_ui.Test_data.common_data import Commondata
from Case.python_ui.PageLocate.user_my_resource_locator import UserMyResourceLocator
from selenium.webdriver.common.by import By
from datetime import datetime
from Case.python_ui.PageLocate.user_slb_locator import UserSLBLocator
from Case.python_ui.Pageobject.user_slb_pages import UserSLBPages
from Case.python_ui.PageLocate.product_management_locator import ProductManagementLocator
from Case.python_ui.Pageobject.admin_product_managent_pages import ProductManagementPages
from Case.python_ui.Common.business_common_tool import BusinessCommonTools
from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException, \
    ElementNotInteractableException

class UserMyResourcePage(Basepage):

    """公共方法"""
    # 等待页面加载转动
    def wait_web_page_rotate(self, time=100):
        doc = '等待页面加载转动图标'
        try:
            self.wait_elevisble(UserMyResourceLocator.wait_for_pay, doc, time)
            self.wait_eleinvisble(UserMyResourceLocator.wait_for_pay, doc, time)
        except:
            pass

    # 清空 Instance ID 查询
    def clear_id_search(self):
        doc = '清空My Resource中的Instance ID查询条件'
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input,doc)
        self.click_element(UserMyResourceLocator.instance_id_input,doc)
        self.keyboard_event_all_select(UserMyResourceLocator.instance_id_input,doc)
        self.keyboard_event(UserMyResourceLocator.instance_id_input,doc)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search,doc)
        self.move_mouse_to_click_element(UserMyResourceLocator.orgnazation_search,doc)
        self.wait_web_page_rotate(30)

    # products列表选择status为vaild
    def select_status_vaild(self):
        doc = '选择status=vaild并查询'
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.click_status,doc)
        self.move_mouse_to_click_element(UserMyResourceLocator.click_status,doc)
        time.sleep(2)
        if self.is_element_disabled(UserMyResourceLocator.click_status_reset):
            self.wait_elevisble(UserMyResourceLocator.select_vaild,doc)
            self.move_mouse_to_click_element(UserMyResourceLocator.select_vaild,doc)
        else:
            self.move_mouse_to_click_element(UserMyResourceLocator.click_status_reset,doc)
            self.wait_elevisble(UserMyResourceLocator.select_vaild, doc)
            self.move_mouse_to_click_element(UserMyResourceLocator.select_vaild, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(UserMyResourceLocator.click_status_ok,doc)
        self.wait_web_page_rotate(10)


    """
        私有
    """
    # 校验某个属性值是否符合预期
    def check_attribute(self, real_result, except_result):
        if real_result == except_result:
            assert True
        else:
            assert False, '实际值:' + real_result + '期望值:' + except_result



    # 判断是否包含元素
    def check_contain_str(self, string, except_string):
        if except_string in string:
            assert True
        else:
            assert False, '实际值:' + string + '期望值:' + except_string


    def get_prod_name_to_click(self,prod_name):
        doc='获取产品名称然后点击'
        prod_list=self.get_elements(ProductManagementLocator.prod_list,doc)
        time.sleep(2)
        for prod in prod_list:
            if prod.text == prod_name:
                prod.click()
        time.sleep(2)

    # 进入My Resource界面
    def enter_my_resource_page(self):
        time.sleep(2)
        doc = "进入My Resource菜单"
        self.wait_elevisble(UserMyResourceLocator.my_resource_menu, doc)
        self.click_element(UserMyResourceLocator.my_resource_menu, doc)
        self.wait_web_page_rotate(20)


    def search_orgnazation(self):
        doc = 'orgnazation搜索查询'
        result = 'sdaaaaaaaaaaaaaaa'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_select, doc)
        self.move_mouse_to_click_element(UserMyResourceLocator.orgnazation_select, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(UserMyResourceLocator.orgnazation_input, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object);
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.orgnazation_result, doc).text, result)

    def search_orgnazation_sublevel(self):
        doc = 'orgnazation搜索查询_子级'
        result = 'test1'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_select, doc)
        self.move_mouse_to_click_element(UserMyResourceLocator.orgnazation_select, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(UserMyResourceLocator.organazation_input2, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object);
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.orgnazation_result, doc).text, result)


    def search_expired_time(self):
        doc = 'expirrd time搜索查询'
        start_time_input = '10-8-2023'
        end_time_input = '10-8-2024'
        result = '2023'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.start_time_select, doc)
        self.send_keys(UserMyResourceLocator.start_time_select, start_time_input, doc)
        self.wait_elevisble(UserMyResourceLocator.end_time_select, doc)
        self.send_keys(UserMyResourceLocator.end_time_select, end_time_input, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object);
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.first_expired_time_result, doc)
        self.check_contain_str(self.get_element(UserMyResourceLocator.first_expired_time_result, doc).text, result)

     # 新增判断按钮是否可以点击方法
    def button_is_enabled(self, locate):
        doc = '判断按钮是否可以点击'
        button = self.get_element(locate, doc)
        for i in range(5):
            time.sleep(2)
            if button.is_enabled():
                button.click()
                break

    #instance id, product name, account email搜索
    def search(self, cmdopt, get_database_source):
        doc = '搜索查询'
        name = 'slb_' + CommonTool.generate_string()
        print(name)
        # success = 'Release Successfully'
        self.enter_my_resource_page()
        time.sleep(4)
        self.wait_elevisble(ProductManagementLocator.cerate_new_tab, doc)
        self.move_mouse_to_element(ProductManagementLocator.cerate_new_tab)
        time.sleep(2)
        self.get_prod_name_to_click('Server Load Balancer')
        time.sleep(2)
        self.switch_to_new_window()
        time.sleep(5)
        self.wait_elevisble(UserSLBLocator.pag_buttoon, doc)
        self.click_element(UserSLBLocator.pag_buttoon, doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.instance_name, doc)
        self.send_keys(UserSLBLocator.instance_name, name, doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.intranet_button, doc)
        self.click_element(UserSLBLocator.intranet_button, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vpc_select, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vpc_first_select, doc)
        time.sleep(5)
        self.click_element(UserSLBLocator.vswitch_select, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vswitch_first_select, doc)
        time.sleep(2)
        self.button_is_enabled(ProductManagementLocator.buy_now_button)
        try:
            self.wait_elevisble(ProductManagementLocator.loading_wait, doc)
            self.wait_eleinvisble(ProductManagementLocator.loading_wait, doc)
        except:
            pass
        self.wait_elevisble(ProductManagementLocator.pay_button, doc)
        time.sleep(5)
        self.click_element(ProductManagementLocator.term_of_service, doc)
        time.sleep(2)
        self.click_element(ProductManagementLocator.pay_button, doc)
        self.wait_elevisble(ProductManagementLocator.pay_successful, doc)
        self.driver.close()
        all_handles = self.driver.window_handles
        self.driver.switch_to.window(all_handles[0])
        instance_id = BusinessCommonTools().get_instance_id(cmdopt, get_database_source)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.instance_id_result, doc).text, instance_id)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_select, doc)
        self.click_element(UserMyResourceLocator.product_name_select, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.product_name_input, 'Server Load Balancer', doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.first_product_name_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.product_name_result, doc).text,'Server Load Balancer')
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.account_email_select, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.account_email_input, Logindata.user_data['sit']['user']['username'], doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.account_email_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.account_email_result, doc).text,Logindata.user_data['sit']['user']['username'])
        time.sleep(2)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserSLBLocator.actions_button, doc)
        self.click_element(UserSLBLocator.actions_button, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.release_button, doc)
        time.sleep(2)
        self.switch_to_new_window()
        time.sleep(5)
        self.wait_elevisble(UserSLBLocator.real_release_button, doc)
        self.click_element(UserSLBLocator.real_release_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.confirm_release_button, doc)
        self.click_element(UserSLBLocator.confirm_release_button, doc)
        time.sleep(5)




    # Reset功能校验
    def reset_instance_id(self, id='HBR-1309'):
        doc = "my_resource中reset功能"
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, id, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        value = self.get_element(UserMyResourceLocator.instance_id_input, doc).get_attribute('value')
        time.sleep(5)
        assert value == id
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button , doc)
        time.sleep(5)
        value = self.get_element(UserMyResourceLocator.instance_id_input, doc).get_attribute('value')
        assert value == ''
        return value

    # expired time 排序
    def expired_time_check(self):
        doc = 'expired time排序功能校验'
        self.enter_my_resource_page()
        time.sleep(5)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        #正序
        self.wait_elevisble(UserMyResourceLocator.expired_time_sort_button, doc)
        self.click_element(UserMyResourceLocator.expired_time_sort_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_creation_times = []
        eles = self.get_elements(UserMyResourceLocator.expired_time, doc)
        # 获取订单创建时间数组
        for ele in eles:
            order_creation_times.append(ele.text)
        print(order_creation_times)
        # 将时间字符串转换为datetime对象，并按照时间顺序排序
        list_times = sorted(map(lambda time_str: datetime.strptime(time_str, "%d-%m-%Y %H:%M:%S"), order_creation_times), reverse=False)
        print(list_times)
        # 将datetime对象列表转换回字符串列表，并按照"%Y-%m-%d %H:%M:%S"格式进行格式化
        dates_as_str = [date.strftime("%d-%m-%Y %H:%M:%S") for date in list_times]
        print(dates_as_str)
        assert dates_as_str == order_creation_times
        # 倒序
        self.wait_elevisble(UserMyResourceLocator.expired_time_sort_button, doc)
        self.click_element(UserMyResourceLocator.expired_time_sort_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_creation_times2 = []
        eles2 = self.get_elements(UserMyResourceLocator.expired_time, doc)
        # 获取订单创建时间数组
        for ele in eles2:
            order_creation_times2.append(ele.text)
        print(order_creation_times2)
        # 将时间字符串转换为datetime对象，并按照时间顺序排序
        list_times2 = sorted(map(lambda time_str: datetime.strptime(time_str, "%d-%m-%Y %H:%M:%S"), order_creation_times2), reverse=True)
        print(list_times2)
        # 将datetime对象列表转换回字符串列表，并按照"%Y-%m-%d %H:%M:%S"格式进行格式化
        dates_as_str2 = [date.strftime("%d-%m-%Y %H:%M:%S") for date in list_times2]
        print(dates_as_str2)
        assert dates_as_str2 == order_creation_times2


    #Region, Billing Method筛选功能
    def region_billing_method_select(self):
        doc = 'Region, Billing Method筛选功能校验'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.click_element(UserMyResourceLocator.billing_method_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.sub_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.pyg_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_billing_method= []
        eles = self.get_elements(UserMyResourceLocator.billing_method_list, doc)
        # 获取订单billing method数组
        for ele in eles:
            order_billing_method.append(ele.text)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.region_select, doc)
        self.click_element(UserMyResourceLocator.region_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.region_first_select, doc)
        self.click_element(UserMyResourceLocator.region_first_select, doc)
        result = self.get_element(UserMyResourceLocator.region_first_select, doc).text
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.region_ok_button, doc)
        self.click_element(UserMyResourceLocator.region_ok_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_region = []
        eles = self.get_elements(UserMyResourceLocator.region_list, doc)
        print(order_billing_method)
        print(order_region)

        for i in order_billing_method:
            if 'Subscription' == i:
                return True
        for i in order_billing_method:
            if 'Pay-As-You-Go' == i:
                return True

        # 获取订单region数组
        for ele in eles:
            order_region.append(ele.text)

        for i in order_region:
            if result == i:
                return True


    #Enable Auto-renewal功能校验
    def aoto_renewal(self,cmdopt, get_database_source):
        doc = 'Enable Auto-renewal功能校验'
        name = 'slb_' + CommonTool.generate_string()
        print(name)
        # success = 'Release Successfully'
        self.enter_my_resource_page()
        time.sleep(4)
        self.wait_elevisble(ProductManagementLocator.cerate_new_tab, doc)
        self.move_mouse_to_element(ProductManagementLocator.cerate_new_tab)
        time.sleep(2)
        self.get_prod_name_to_click('Server Load Balancer')
        # 将光标移走，关闭tab页
        self.wait_elevisble(UserMyResourceLocator.my_resource_menu, doc)
        self.move_mouse_to_element(UserMyResourceLocator.my_resource_menu)
        time.sleep(2)
        self.switch_to_new_window()
        self.wait_web_page_rotate(5)
        self.wait_elevisble(UserSLBLocator.billing_method,doc)
        self.move_mouse_to_click_element(UserSLBLocator.billing_method,doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.instance_name, doc)
        self.send_keys(UserSLBLocator.instance_name, name, doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.intranet_button, doc)
        self.click_element(UserSLBLocator.intranet_button, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vpc_select, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vpc_first_select, doc)
        time.sleep(5)
        self.click_element(UserSLBLocator.vswitch_select, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.vswitch_first_select, doc)
        time.sleep(2)
        self.button_is_enabled(ProductManagementLocator.buy_now_button)
        try:
            self.wait_elevisble(ProductManagementLocator.loading_wait, doc)
            self.wait_eleinvisble(ProductManagementLocator.loading_wait, doc)
        except:
            pass
        self.wait_elevisble(ProductManagementLocator.pay_button, doc)
        time.sleep(5)
        self.click_element(ProductManagementLocator.term_of_service, doc)
        time.sleep(2)
        self.click_element(ProductManagementLocator.pay_button, doc)
        self.wait_elevisble(ProductManagementLocator.pay_successful, doc)
        self.driver.close()
        all_handles = self.driver.window_handles
        self.driver.switch_to.window(all_handles[0])
        instance_id = BusinessCommonTools().get_instance_id(cmdopt, get_database_source)
        self.wait_web_page_rotate(20)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        self.wait_web_page_rotate(60)
        # enable
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object);
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.enable_auto_renewal_button, doc)
        self.click_element(UserMyResourceLocator.enable_auto_renewal_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.button_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.button_result, doc).text, 'Y')
        time.sleep(2)
        # disable
        self.wait_elevisble(UserMyResourceLocator.disable_auto_renewal_button, doc)
        self.click_element(UserMyResourceLocator.disable_auto_renewal_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(3)
        self.wait_elevisble(UserMyResourceLocator.button_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.button_result, doc).text, 'N')
        self.wait_elevisble(UserSLBLocator.actions_button, doc)
        self.click_element(UserSLBLocator.actions_button, doc)
        time.sleep(2)
        self.click_element(UserSLBLocator.release_button, doc)
        time.sleep(2)
        self.switch_to_new_window()
        time.sleep(5)
        self.wait_elevisble(UserSLBLocator.real_release_button, doc)
        self.click_element(UserSLBLocator.real_release_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserSLBLocator.confirm_release_button, doc)
        self.click_element(UserSLBLocator.confirm_release_button, doc)




    # OSS流量告警悬浮显示数据功能校验
    def traffic_monitor(self):
        doc = 'Enable Auto-renewal功能校验'
        product_name = 'Object Storage Service'
        self.enter_my_resource_page()
        time.sleep(5)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_select, doc)
        self.click_element(UserMyResourceLocator.product_name_select, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.product_name_input, product_name, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.first_product_name_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.traffic_monitor_button, doc)
        self.click_element(UserMyResourceLocator.traffic_monitor_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.usage_notification_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.notification_threshold_input, doc)
        self.send_keys(UserMyResourceLocator.notification_threshold_input, 111, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.notification_user_list_input,Logindata.user_data['sit']['user']['username'], doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.notification_user_list_result, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(5)
        self.move_mouse_to_click_element(UserMyResourceLocator.percentage_of_progress, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.result_monitor, doc)
        self.check_contain_str(self.get_element(UserMyResourceLocator.result_monitor, doc).text,'Current Billing Cycle')
        time.sleep(2)
        self.move_mouse_to_element(UserMyResourceLocator.reset_button)
        self.wait_elevisble(UserMyResourceLocator.close_traffic_monitor_button, doc)
        self.click_element(UserMyResourceLocator.close_traffic_monitor_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.usage_notification_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)


    # total used和billing cycle切换功能
    def statistical_period_change(self):
        doc = 'total used和billing cycle切换功能'
        product_name = 'Object Storage Service'
        result1 = 'This Billing Cycle'
        result2 = 'Total Used'
        self.enter_my_resource_page()
        time.sleep(5)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_select, doc)
        self.click_element(UserMyResourceLocator.product_name_select, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.product_name_input, product_name, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.first_product_name_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.traffic_monitor_button, doc)
        self.click_element(UserMyResourceLocator.traffic_monitor_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.usage_notification_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.notification_threshold_input, doc)
        self.send_keys(UserMyResourceLocator.notification_threshold_input, 111, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.notification_user_list_input,Logindata.user_data['sit']['user']['username'], doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.notification_user_list_result, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(5)
        self.check_contain_str(self.get_element(UserMyResourceLocator.percentage_of_progress, doc).text, result1)
        time.sleep(2)
        self.move_mouse_to_element(UserMyResourceLocator.reset_button)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.close_traffic_monitor_button, doc)
        self.click_element(UserMyResourceLocator.close_traffic_monitor_button, doc)
        time.sleep(3)
        self.wait_elevisble(UserMyResourceLocator.statistical_period_select, doc)
        self.click_element(UserMyResourceLocator.statistical_period_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.statistical_period_sencond, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(5)
        self.check_contain_str(self.get_element(UserMyResourceLocator.percentage_of_progress, doc).text, result2)
        self.move_mouse_to_element(UserMyResourceLocator.reset_button)
        self.wait_elevisble(UserMyResourceLocator.close_traffic_monitor_button, doc)
        self.click_element(UserMyResourceLocator.close_traffic_monitor_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.usage_notification_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)


    # 修改PAYG类型的订单到期时间
    def edit_pag_expired_time(self):
        doc = '修改PAYG类型的订单到期时间'
        result1 = '02-05-2027'
        result2 = '03-05-2027'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(10)
        self.clear_id_search()
        self.click_element(UserMyResourceLocator.billing_method_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.pyg_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(5)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        self.select_status_vaild()
        self.wait_elevisble(UserMyResourceLocator.edit_expired_time, doc)
        self.click_element(UserMyResourceLocator.edit_expired_time, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.input_expired_time, doc)
        #self.keyboard_event(UserMyResourceLocator.input_expired_time, doc)
        self.click_element(UserMyResourceLocator.input_expired_time, doc)
        self.keyboard_event_all_select(UserMyResourceLocator.input_expired_time, doc)
        self.keyboard_event_enter(UserMyResourceLocator.input_expired_time, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.input_expired_time, result2, doc)
        time.sleep(2)
        result3= self.get_element(UserMyResourceLocator.modify_page_instance_id, doc).text
        self.click_element(UserMyResourceLocator.time_filter, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.modify_expired_time_ok_button, doc)
        self.click_element(UserMyResourceLocator.modify_expired_time_ok_button, doc)
        self.wait_web_page_rotate(10)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.clear_id_search()
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, result3, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        self.wait_web_page_rotate(5)
        self.check_contain_str(self.get_element(UserMyResourceLocator.first_expired_time_result, doc).text, result2)



    # Change Organization功能校验
    def change_organization(self, instance_id):
        doc = 'Change Organization功能校验'
        # self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        # self.click_element(UserMyResourceLocator.reset_button, doc)
        # time.sleep(5)
        # self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.clear_id_search()
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        self.wait_web_page_rotate(60)
        self.wait_elevisble(UserMyResourceLocator.actions_button, doc)
        self.click_element(UserMyResourceLocator.actions_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.change_organization_button, doc)
        time.sleep(2)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.change_organization_select, doc)
        self.click_element(UserMyResourceLocator.change_organization_select, doc)
        time.sleep(2)
        result = self.get_element(UserMyResourceLocator.change_organization_second_select, doc).text
        print('result:',result)
        self.move_mouse_to_click_element(UserMyResourceLocator.change_organization_second_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.submit_button, doc)
        time.sleep(10)
        self.check_attribute(self.get_element(UserMyResourceLocator.second_orgnization, doc).text, result)

        # product name查询功能
    def search_product_name(self):
        # 当前查询对应用户已申请资源
        doc = '按product name搜索查询'
        product_name = 'Log Service'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_select, doc)
        self.click_element(UserMyResourceLocator.product_name_select, doc)
        time.sleep(2)
        self.send_keys(UserMyResourceLocator.product_name_input, product_name, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.first_product_name_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.product_name_result, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.product_name_result, doc).text, product_name)
        time.sleep(2)

    # 列表字段
    def view_list(self):
        doc = '查看列表字段'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.Instance_ID, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Instance_ID, doc).text, 'Instance ID')
        self.wait_elevisble(UserMyResourceLocator.Product_Name, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Product_Name, doc).text, 'Product')
        self.wait_elevisble(UserMyResourceLocator.Region, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Region, doc).text, 'Region')
        self.wait_elevisble(UserMyResourceLocator.Billing_Method, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Billing_Method, doc).text, 'Billing Method')
        self.wait_elevisble(UserMyResourceLocator.traffic_monitor, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.traffic_monitor, doc).text, 'Traffic Monitor (GB)')
        self.wait_elevisble(UserMyResourceLocator.Created_Time, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Created_Time, doc).text,'Created Time (UTC+08:00)')
        self.wait_elevisble(UserMyResourceLocator.Expired_Time, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Expired_Time, doc).text,'Expired Time (UTC+08:00)')
        self.wait_elevisble(UserMyResourceLocator.Product_Type, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Product_Type, doc).text, 'Product Type')
        self.wait_elevisble(UserMyResourceLocator.Status, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Status, doc).text, 'Status')
        time.sleep(2)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object);
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.Enable_Auto_renewal, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Enable_Auto_renewal, doc).text, 'Enable Auto-renewal')
        self.wait_elevisble(UserMyResourceLocator.auto_renewal_alidity_period, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.auto_renewal_alidity_period, doc).text, 'Auto-renewal Validity Period')
        self.wait_elevisble(UserMyResourceLocator.Auto_Scaling, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Auto_Scaling, doc).text, 'Auto Scaling')
        self.wait_elevisble(UserMyResourceLocator.Oraganization, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Oraganization, doc).text, 'Organization')
        self.wait_elevisble(UserMyResourceLocator.Account_Email, doc)
        self.check_attribute(self.get_element(UserMyResourceLocator.Account_Email, doc).text, 'Account Email')



        # My resource页面开启/关闭自动续费开关
    def renewal_status_check(self, instance_id):
        doc = 'My resource页面开启/关闭自动续费开关'
        self.enter_my_resource_page()
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(5)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        self.click_element(UserMyResourceLocator.renewal_status_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(2)
        self.check_contain_str(self.get_element(UserMyResourceLocator.validity_period, doc).text, 'validity.period')
        self.check_attribute(self.get_element(UserMyResourceLocator.renewal_status_YN, doc).text, 'Y')
        self.click_element(UserMyResourceLocator.renewal_status_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(2)
        self.check_attribute(self.get_element(UserMyResourceLocator.renewal_status_YN, doc).text, 'N')

    def clear_filter_status(self, locate, status_filter_reset_button, status_filter_ok_button):
        doc = '清空筛选状态'
        try:
                # 点击筛选按钮
            time.sleep(2)
            self.click_element(locate, doc)
            time.sleep(2)
            # 点击reset按钮
            self.click_element(status_filter_reset_button, doc)
        except ElementNotInteractableException as e:
            self.click_element(status_filter_ok_button, doc)
            return
        except ElementClickInterceptedException as e:
            self.click_element(status_filter_ok_button, doc)
            return
        else:
            time.sleep(2)
            self.click_element(status_filter_ok_button, doc)
            return

        # order界面筛选项清空
    def orders_clear_status(self):
        self.clear_filter_status(UserSLBLocator.product_filter_button, UserSLBLocator.status_filter_reset_button,
                                 UserSLBLocator.status_filter_ok_button)
        time.sleep(2)
        self.clear_filter_status(UserSLBLocator.order_type_filter_button, UserSLBLocator.status_filter_reset_button2,
                                 UserSLBLocator.status_filter_ok_button2)
        time.sleep(2)
        self.clear_filter_status(UserSLBLocator.order_status_filter_button, UserSLBLocator.status_filter_reset_button3,
                                 UserSLBLocator.status_filter_ok_button3)
        time.sleep(2)
        self.clear_filter_status(UserSLBLocator.billing_method_filter_button,
                                 UserSLBLocator.status_filter_reset_button4, UserSLBLocator.status_filter_ok_button4)

     # 系统自动续费任务验证(产品:slb)
    def job_auto_renewal_slb(self,cmdopt,get_database_source,instance_id):
        doc = '系统自动续费任务验证'

        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        self.click_element(UserMyResourceLocator.renewal_status_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(2)
        BusinessCommonTools().update_slb_expired_time(cmdopt,get_database_source)
        time.sleep(10)
        BusinessCommonTools().update_job_slb_renew_next_trigger_time(cmdopt,get_database_source)
        time.sleep(30)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.orders_mene, doc)
        time.sleep(2)
        self.orders_clear_status()
        type = self.get_element(UserMyResourceLocator.renew_order_type, doc).text
        self.check_attribute(type, 'Renew')



    # my resource页面修改auto renewal validity period验证
    def modify_auto_renew(self,instance_id):
        doc = 'my resource页面修改auto renewal validity period验证'
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.keyboard_event(UserMyResourceLocator.instance_id_input,doc)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        self.click_element(UserMyResourceLocator.renewal_status_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.auto_renew_edit_button, doc)
        time.sleep(2)
        self.check_attribute(self.get_element(UserMyResourceLocator.new_renew_select_button, doc).text, '1 Month')
        self.click_element(UserMyResourceLocator.new_renew_select_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.new_renew_second_choose, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.ok_button, doc)
        time.sleep(3)
        self.check_attribute(self.get_element(UserMyResourceLocator.renew_period_list, doc).text, '2 Month')




      # create time 排序
    def create_time_check(self):
        doc = 'create time排序功能校验'
        self.enter_my_resource_page()
        time.sleep(5)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        #正序
        self.wait_elevisble(UserMyResourceLocator.create_time_sort_button, doc)
        self.click_element(UserMyResourceLocator.create_time_sort_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_creation_times = []
        eles = self.get_elements(UserMyResourceLocator.create_time, doc)
        # 获取订单创建时间数组
        for ele in eles:
            order_creation_times.append(ele.text)
        print(order_creation_times)
        # 将时间字符串转换为datetime对象，并按照时间顺序排序
        list_times = sorted(map(lambda time_str: datetime.strptime(time_str, "%d-%m-%Y %H:%M:%S"), order_creation_times), reverse=False)
        print(list_times)
        # 将datetime对象列表转换回字符串列表，并按照"%Y-%m-%d %H:%M:%S"格式进行格式化
        dates_as_str = [date.strftime("%d-%m-%Y %H:%M:%S") for date in list_times]
        print(dates_as_str)
        assert dates_as_str == order_creation_times
        # 倒序
        self.wait_elevisble(UserMyResourceLocator.create_time_sort_button, doc)
        self.click_element(UserMyResourceLocator.create_time_sort_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.list_first_line, doc)
        order_creation_times2 = []
        eles2 = self.get_elements(UserMyResourceLocator.create_time, doc)
        # 获取订单创建时间数组
        for ele in eles2:
            order_creation_times2.append(ele.text)
        print(order_creation_times2)
        # 将时间字符串转换为datetime对象，并按照时间顺序排序
        list_times2 = sorted(map(lambda time_str: datetime.strptime(time_str, "%d-%m-%Y %H:%M:%S"), order_creation_times2), reverse=True)
        print(list_times2)
        # 将datetime对象列表转换回字符串列表，并按照"%Y-%m-%d %H:%M:%S"格式进行格式化
        dates_as_str2 = [date.strftime("%d-%m-%Y %H:%M:%S") for date in list_times2]
        print(dates_as_str2)
        assert dates_as_str2 == order_creation_times2



    def check_change_organization(self,instance_id):
        doc = '企业账号给支持的私有云产品切换组织'
        self.wait_elevisble(UserMyResourceLocator.reset_button, doc)
        self.click_element(UserMyResourceLocator.reset_button, doc)
        time.sleep(5)
        self.wait_elevisble(UserMyResourceLocator.search_select, doc)
        self.click_element(UserMyResourceLocator.search_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.instance_id_select, doc)
        time.sleep(2)
        self.keyboard_event(UserMyResourceLocator.instance_id_input, doc)
        self.wait_elevisble(UserMyResourceLocator.instance_id_input, doc)
        self.send_keys(UserMyResourceLocator.instance_id_input, instance_id, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.orgnazation_search, doc)
        self.click_element(UserMyResourceLocator.orgnazation_search, doc)
        time.sleep(5)
        js_object = 'document.getElementsByClassName("antd4-table-content")[0].scrollTo(1000,10000)'
        self.excute_js(js_object)
        self.wait_elevisble(UserMyResourceLocator.actions_button, doc)
        self.click_element(UserMyResourceLocator.actions_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.change_organization_button, doc)
        time.sleep(2)
        self.wait_elevisble(UserMyResourceLocator.change_organization_select, doc)
        self.click_element(UserMyResourceLocator.change_organization_select, doc)
        time.sleep(2)
        result = self.get_element(UserMyResourceLocator.change_organization_second_select, doc).text
        self.click_element(UserMyResourceLocator.change_organization_second_select, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.submit_button, doc)
        time.sleep(10)
        self.check_attribute(self.get_element(UserMyResourceLocator.second_orgnization, doc).text, result)
        self.click_element(UserMyResourceLocator.renew_button, doc)
        time.sleep(2)
        self.switch_to_new_window()
        time.sleep(5)
        self.check_attribute(self.get_element(UserMyResourceLocator.renew_modify_page_organization, doc).text, result)
        self.driver.close()
        all_handles = self.driver.window_handles
        self.driver.switch_to.window(all_handles[0])
        self.click_element(UserMyResourceLocator.actions_button, doc)
        time.sleep(2)
        self.click_element(UserMyResourceLocator.modify_button, doc)
        time.sleep(2)
        self.switch_to_new_window()
        time.sleep(5)
        self.check_attribute(self.get_element(UserMyResourceLocator.renew_modify_page_organization, doc).text, result)





    def check_create_new(self):
        doc = 'create new跳转逻辑验证'
        self.enter_my_resource_page()
        time.sleep(4)
        self.wait_elevisble(ProductManagementLocator.cerate_new_tab, doc)
        self.move_mouse_to_element(ProductManagementLocator.cerate_new_tab)
        time.sleep(2)
        self.get_prod_name_to_click('Server Load Balancer')
        time.sleep(2)
        self.switch_to_new_window()
        self.wait_web_page_rotate(10)
        self.check_attribute(self.get_element(UserMyResourceLocator.slb_page_title, doc).text, 'Server Load Balancer')
        # self.driver.close()
        # all_handles = self.driver.window_handles
        # self.driver.switch_to.window(all_handles[0])
        # self.wait_elevisble(ProductManagementLocator.cerate_new_tab, doc)
        # self.move_mouse_to_element(ProductManagementLocator.cerate_new_tab)
        # time.sleep(2)
        # self.get_prod_name_to_click('Threat Detection Service')
        # time.sleep(10)
        # self.check_attribute(self.get_element((UserMyResourceLocator.TDS_title, doc).text, 'Threat Detection Service'))































